Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Jib Ownership Maven Extension #1

Merged
merged 16 commits into from
Jun 1, 2020
Merged

Add Jib Ownership Maven Extension #1

merged 16 commits into from
Jun 1, 2020

Conversation

chanseokoh
Copy link
Member

@chanseokoh chanseokoh commented May 27, 2020

Towards GoogleContainerTools/jib#1257 and GoogleContainerTools/jib#1955, as well as a workaround for GoogleContainerTools/jib#1270.

The Jib Maven extension allows the user to customize file ownership in layers.

The following example sets UID 300 and GID 500 for /app/classes/**.

<configuration>
  <pluginExtensions>
    <pluginExtension>
      <implementation>com.google.cloud.tools.jib.plugins.extension.maven.ownership.JibOwnershipExtension</implementation>
      <configuration implementation="com.google.cloud.tools.jib.plugins.extension.maven.ownership.Configuration">
        <rules>
          <rule>
            <glob>/app/classes/**</glob>
            <ownership>300:500</ownership>
          </rule>
        </rules>
      </configuration>
    </pluginExtension>

However, due to the way Jib adding parent directory tarball entries, the directories /app and /app/classes will continue to have the ownership 0:0 (root:root). Considering the use-case of Skaffold, we should verify if this can cover the use-case; otherwise, we may need to revisit GoogleContainerTools/jib#1270.

@chanseokoh chanseokoh changed the base branch from master to setup-travis May 29, 2020 15:19
Base automatically changed from setup-travis to master May 29, 2020 19:28
@loosebazooka
Copy link
Member

can we change the PR description to describe the ownership extension?

@chanseokoh chanseokoh changed the title Maven Ownership extension Add Jib Ownership Maven Extension May 29, 2020
return buildPlan.toBuilder().setLayers(newLayers).build();
}

private FileEntriesLayer modifyLayer(FileEntriesLayer layer) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think modify technically isn't the process happening here? We're creating a new layer with changed values?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the names to applyRulesToLayer/FileEntry. That said, I changed Configuration.Entry to Configuration.Rule. The latter sounds better.

@chanseokoh
Copy link
Member Author

Updated the description. Worth checking.

I'll take care of the code comments next week.

@chanseokoh chanseokoh merged commit 0700987 into master Jun 1, 2020
@chanseokoh chanseokoh deleted the ownership-maven branch June 1, 2020 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants